package Buffer;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

public class PropertiesDemo {
    public static void main(String[] args) throws IOException {
       /*
       Properties prop = new Properties();

        prop.put("001","zbd");
        prop.put("002","zbd");
        prop.put("003","zbd");

        Set<Object> objects = prop.keySet();
        for (Object bj : objects
        ) {
            Object o = prop.get(bj);
            System.out.println(bj+","+o);
        }
        */
        /*
        Properties prop = new Properties();
        prop.setProperty("123" , "asf");
        prop.setProperty("121" , "asf");
        prop.setProperty("122" , "asf");
        Set<String> strings = prop.stringPropertyNames();
        for (String s : strings
        ) {
            System.out.println(s + "," + prop.getProperty(s));
        }
        */

        // 吧集合中的数据保存到文件
        Properties prop = new Properties();

        prop.setProperty("123", "asd");
        prop.setProperty("121", "asd");
        prop.setProperty("122", "asd");

        FileWriter fw = new FileWriter("funCode\\fis.txt");

        prop.store(fw,"");

        fw.close();
    }
}
